import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';
export namespace PerFamilyStudyApi {
  /** 求学情况表信息 */
  export interface FamilyStudy {
    id: number; // 主键ID
    employeeId?: number; // 人员ID，对应 per_employee.id
    relation: string; // 与本人关系（称谓）
    systemPersonId: number; // 系统人员ID，对应system_person.id
    familyName: string; // 姓名
    cardType: string; // 证件类型
    familyIdcard: string; // 证件号码
    studyCountry: string; // 求学国家
    schoolName: string; // 学校名称
    studyAbroadDate: string; // 出国时间
    annualExpense: string; // 每年留学费用
    expenseSource: string; // 费用来源
    isUsing: number; // 是否在读（1：是，0：否）
    status: number; // 是否有效（1：有效，0：无效）
    remarks: string; // 备注
  }
}

/** 查询求学情况表分页 */
export function getFamilyStudyPage(
  data: PageParam,
  desensitize: boolean,
  encrypt: boolean,
) {
  return requestClient.post<PageResult<PerFamilyStudyApi.FamilyStudy>>(
    '/per/family-study/page',
    data,
    { desensitize, encrypt },
  );
}

/** 查询求学情况表详情 */
export function getFamilyStudy(id: number) {
  return requestClient.get<PerFamilyStudyApi.FamilyStudy>(
    `/per/family-study/get?id=${id}`,
  );
}

/** 新增求学情况表 */
export function createFamilyStudy(data: PerFamilyStudyApi.FamilyStudy) {
  return requestClient.post('/per/family-study/create', data);
}

/** 修改求学情况表 */
export function updateFamilyStudy(data: PerFamilyStudyApi.FamilyStudy) {
  return requestClient.put('/per/family-study/update', data);
}

/** 删除求学情况表 */
export function deleteFamilyStudy(id: number) {
  return requestClient.delete(`/per/family-study/delete?id=${id}`);
}

/** 批量删除求学情况表 */
export function deleteFamilyStudyList(ids: number[]) {
  return requestClient.delete(
    `/per/family-study/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出求学情况表 */
export function exportFamilyStudy(params: any) {
  return requestClient.download('/per/family-study/export-excel', { params });
}
